<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      document.write("打印出1000-2000年中所有的闰年，并以每行四个数的形式输出");
      document.write("<br>");
      var tag = 0;
      for (var i = 1000; i <= 2000; i++) {
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
          ++tag;
          document.write(i + "  ");
          if (tag % 4 == 0) document.write("<br>");
        }
      }
    </script>
  </body>
</html>
